function tabs(id,trigger,autoplay,time){
	var tabsWrap = document.getElementById(id);
	var tabsBtn = tabsWrap.getElementsByTagName('h2')[0].getElementsByTagName('a');
	var tabsContent = getClass('tabs-content',tabsWrap);
	var timer = null;
	var current = 0;
	
	show(0);
	
	for(var i = 0,len = tabsBtn.length; i < len; i++){
		tabsBtn[i].index = i;
		if(trigger == 'click'){
			tabsBtn[i].onclick = function(){
				show(this.index);
			}
		}else if(trigger == 'mouseover'){
			tabsBtn[i].onmouseover = function(){
				show(this.index);
			}
		}
	}
	
	if(autoplay){
		autoPlay();
		tabsWrap.onmouseover = function(){
			clearInterval(timer);
		}
		tabsWrap.onmouseout = function(){
			autoPlay();
		}
	}
	
	function autoPlay(){
		timer = setInterval(function(){
			show(current);
			current++;
			if(current >= tabsBtn.length){
				current = 0;
			}
		},time);
	}
	
	function show(n){
		current = n;
		for(var i = 0,len = tabsBtn.length; i < len; i++){
			tabsBtn[i].className = '';
			tabsContent[i].style.display = 'none';
		}
		tabsBtn[current].className = 'current' + (current + 1);
		tabsContent[current].style.display = 'block';
	}
	
	function getClass(classname,obj){
		var results = [];
		var elems = obj.getElementsByTagName('*');
		for(var i = 0; i < elems.length; i++){
			if(elems[i].className.indexOf(classname) != -1){
				results[results.length] = elems[i];
			}
		}
		return results;
	}
}